API: Get an Alert Body

Related issue: /forum/t/alert-body/1599

Request

Expose the raw text of an Alert Body in the REST API.

User Story

Our alert bodies, that are often triggered by webhooks or email integrations, contain dynamically generated data about the alert. As someone who manages a number of PagerDuty services, I want to be able to collect that data via the API and parse it so that business decisions can be made on that data.

@JasonOliva,

Going on the assumption that the services have been configured to create “alerts and incidents” the raw data is available via the API and the incident endpoint. You can iterate across all incidents and pass an include option to send the first trigger log entry object which has all of the alert data.

Cheers

Hi Jason,

Just to clarify, as long as the service that you are looking to extract alert data for is configured to create ‘Alerts and Incidents’ you can use our API to first list incidents that were created on a service which contains the associated alert IDs. Next, you can iterate across the alert ID collection to get the data you are looking for.

https://api-reference.pagerduty.com/#!/Incidents/get_incidents
https://api-reference.pagerduty.com/#!/Incidents/get_incidents_id_alerts_alert_id

Feel free to let me know if this isn’t what your feature request was about.

Regards,
Sean Noble

Ah, looks like you have to specifically include “channels” with the https://api-reference.pagerduty.com/#!/Incidents/get_incidents_id_alerts_alert_id call. This will include a response with:

“channel”: {
“type”: “email”,
“summary”: “summary of the email”,
“to”: “recipient”,
“from”: “sender”,
“body”: “some body”…
}

And that “body” has the raw text I was expecting to find.

Thanks for the responses, Chiedu and Sean.

This topic should be closed as the feature is already in the API.